using MidnightPeach.Engine.Packages;
using MidnightPeach.Engine.Schema;
using MidnightPeach.Engine.Schema.ServiceSchema;

namespace MidnightPeach.Engine.Generators.ServiceGenerators
{
    class ParameterGenerator : ServiceGenerator
    {
        public ParameterGenerator(Package package, Parameter parameter) : base(package)
        {
            Parameter = parameter;
        }

        public Parameter Parameter { get; private set; }

        internal override string Generate(Macro macro, string text)
        {
            switch (macro.Value)
            {
                case "PascalName":
                    return Parameter.PascalName;

                case "CamelName":
                    return Parameter.CamelName;

                case "Type":
                    return Parameter.TypeName;

                default:
                    throw new UnsupportedMacroException(macro, text, this);
            }
        }
    }
}